/*
 * ChChangerView.java
 */

package chchanger;

import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;

/**
 * The application's main frame.
 */
public class ChChangerView extends FrameView {

    public ChChangerView(SingleFrameApplication app) {
        super(app);
        initComponents();

		control = new ControlSysFs();
	}

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        currentFreq = new javax.swing.JTextField();
        incFreqButton = new javax.swing.JButton();
        decFreqButton = new javax.swing.JButton();
        incrementFreq = new javax.swing.JTextField();
        setFreq = new javax.swing.JTextField();
        setFreqButton = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();

        mainPanel.setName("mainPanel"); // NOI18N

        currentFreq.setName("currentFreq"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(chchanger.ChChangerApp.class).getContext().getResourceMap(ChChangerView.class);
        incFreqButton.setText(resourceMap.getString("incFreqButton.text")); // NOI18N
        incFreqButton.setName("incFreqButton"); // NOI18N
        incFreqButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                incFreqButtonActionPerformed(evt);
            }
        });

        decFreqButton.setText(resourceMap.getString("decFreqButton.text")); // NOI18N
        decFreqButton.setName("decFreqButton"); // NOI18N
        decFreqButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                decFreqButtonActionPerformed(evt);
            }
        });

        incrementFreq.setText(resourceMap.getString("incrementFreq.text")); // NOI18N
        incrementFreq.setName("incrementFreq"); // NOI18N

        setFreq.setName("setFreq"); // NOI18N

        setFreqButton.setText(resourceMap.getString("setFreqButton.text")); // NOI18N
        setFreqButton.setName("setFreqButton"); // NOI18N
        setFreqButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                setFreqButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(currentFreq, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(setFreq, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(incrementFreq, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 195, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addComponent(decFreqButton, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(incFreqButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(setFreqButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(currentFreq, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(incrementFreq, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incFreqButton)
                    .addComponent(decFreqButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(setFreq, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(setFreqButton))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(chchanger.ChChangerApp.class).getContext().getActionMap(ChChangerView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        setComponent(mainPanel);
        setMenuBar(menuBar);
    }// </editor-fold>//GEN-END:initComponents

	private void incFreqButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incFreqButtonActionPerformed
		control.setInc(Integer.valueOf(incrementFreq.getText()));
	}//GEN-LAST:event_incFreqButtonActionPerformed

	private void decFreqButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_decFreqButtonActionPerformed
		control.setInc(-1*Integer.valueOf(incrementFreq.getText()));
	}//GEN-LAST:event_decFreqButtonActionPerformed

	private void setFreqButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setFreqButtonActionPerformed
		control.set(Integer.valueOf(setFreq.getText()));
	}//GEN-LAST:event_setFreqButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField currentFreq;
    private javax.swing.JButton decFreqButton;
    private javax.swing.JButton incFreqButton;
    private javax.swing.JTextField incrementFreq;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JTextField setFreq;
    private javax.swing.JButton setFreqButton;
    // End of variables declaration//GEN-END:variables

	ControlAbstract control;
}
